package game.players.user;

import com.uqbar.vainilla.appearances.Animation;
import com.uqbar.vainilla.appearances.Sprite;

import game.players.SoccerPlayer;
import game.players.states.PassingPlayer;
import game.players.user.movements.WithoutBallStationaryUser;

public class PassingUserPlayer extends PassingPlayer {

	public PassingUserPlayer(SoccerPlayer player, SoccerPlayer target) {
		super(player, target);
		
		player.setAppearance(new Animation(0.1,
				Sprite.fromImage("/images/goal3_pase2.png").crop(0, 1, 39, 64).scale(1.5),
				Sprite.fromImage("/images/goal3_pase2.png").crop(52, 0, 47, 64).scale(1.5)
				));
	}
	
	@Override
	protected void changeToStationary() {
		this.getPlayer().setState(new WithoutBallStationaryUser(this.getPlayer()));
	}

	@Override
	public boolean isRight() {
		return true;
	}

	@Override
	public void loseTheBall() {
		this.getTimer().cancel();
		this.getPlayer().setState(new BeatenUserPlayer(this.getPlayer(), this.isRight()));
	}

}
